#{extends 'main.html' /}

<div id=main>

#{if userEntry==false}
</br>
You should join the organization to be able to view it's entities
<li><a href="@{Organizations.showOrganization(topicOrganization.id)}">Go to Organization</a>
			</li>

#{/if}

#{else}
<div id="right">

	<p class="field">
		<label>Topic author: </label> ${topic.author.name}
	</p>
	<p class="field">
		<label>Topic title: </label> ${topic.title}
	</p>
	<p class="field">
		<label>Description: </label> ${topic.body}
	</p>
	<p class="field">
		<label>Topic posted on: </label> ${topic.postedAt}
	</p>
	<p>


		#{if user.email==topic.author.email} <a
			href="@{Topics.executeTopic(topic.id,topic.entity.id)}">ExecuteTopic</a>
		#{/if}
		#{if inSubscriber==false} <a href="@{Topics.addSubscriber(topic.id)}"
			class="pill button">Follow</a><br /> #{/if} #{if inSubscriber==true} <a
			href="@{Topics.removeSubscriber(topic.id)}" class="pill button">Unfollow</a><br />
		#{/if}  
			
			#{if authorized}
			#{if topic.isLocked==false} <a
			href="@{Topics.lockTopic(topic.id)}" class="pill button">Lock</a><br />
		#{/if} #{if topic.isLocked==true} <a
			href="@{Topics.unlockTopic(topic.id)}" class="pill button">Unlock</a><br />
		#{/if}
		#{/if}


	</p>
	<!--  {/if}-->
	#{if topic.spam == false}
	<h1>
		<a href="@{Topics.showTopicSpam(topic.id)}"
			onclick="alert ('The Topic has been spammed');">spam </a>
	</h1>
	#{/if} #{else}
	<h1>This topic is spammed</h1>
	#{/else} <br>
	<a href="@{PostingIdea.showTopicIdeas(topic.id)}" class="pill button">Show
		Topic Ideas</a><br />

	<li><a href="@{PostingIdea.Post(topic.id)}"> Post Idea To
			Topic</a>
	</li>
	<li><a href="@{Application.index()}"> Back to home</a>
	</li>
	<li><a href="@{Topics.listOfAllTopics(topic.entity.id)}"> Back
			to topics</a>
	</li>
</div>
#{/else}
</div>